package com.kingwang.training.designpattern.command.bo;

import java.util.ArrayList;
import java.util.List;

/**
 * 执行人
 * 宏命令
 */
public class Staff implements Command {

    private List<Command> commands = new ArrayList<>();

    public void addCommand(Command command) {
        this.commands.add(command);
    }

    @Override
    public void execute() {
        this.commands.forEach(i -> i.execute());
        this.commands.clear();
    }
}